<template>
  <div class="container enroll">
    <auth
      v-if="authent"
      :formData="authent"
    ></auth>
    <formauth
      v-else
      @submit="onSubmit"
    ></formauth>
  </div>
</template>

<script>
import Formauth from '@/components/formauth/formauth'
import Auth from '@/components/formauth/auth'

// import { postAuthentApi, getAuthentApi } from '@/api'
import { getAuthentApi } from '@/api'
export default {
  components: {
    Formauth,
    Auth
  },

  data () {
    return {
      authent: null
    }
  },
  onShow () {
    this.onLoadData()
  },
  methods: {
    onLoadData () {
      getAuthentApi().then(res => {
        this.authent = res
        console.log(this.authent)
      })
    },
    onSubmit (e) {
      console.log(e)
      // postAuthentApi(e).then(res => {
      //   wx.showToast({
      //     title: '认证信息提交成功'
      //   })
      // })
    }
  }
}
</script>

<style lang="less">
.container {
  background: #f7f7fa;
  padding: 10px;
}
</style>
